package com.design.softwaredesign.controller;

import com.design.softwaredesign.front.WebAdmin;
import com.design.softwaredesign.service.BackLoginService;
import com.design.softwaredesign.utils.login.LoginUtil;
import com.design.softwaredesign.vo.DataVo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author :WaiterXiaoYY
 * @description: TODO
 * @data :2020/11/3 16:07
 */
@Api(description = "管理后台控制层-管理员登录")
@RestController
@RequestMapping("/web/admin")
public class BackLoginController {
    @Autowired
    private BackLoginService backLoginService;

    @PostMapping("/login")
    public DataVo login(@RequestBody WebAdmin webAdmin) throws Exception {
        DataVo dataVo = new DataVo();
        dataVo = new LoginUtil().webIsTrue(webAdmin.getUsername(), webAdmin.getPassword(), backLoginService);
        return dataVo;
    }
}
